package com.mt.roll.core.dal.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 资源表
 * </p>
 *
 * @author mt
 * @since 2021-12-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_resource")
public class Resource extends Model<Resource> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，自增
     */
      @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 服务ID
     */
    @TableField("service_id")
    private Long serviceId;

    /**
     * 名称
     */
    @TableField("name")
    private String name;

    /**
     * 请求地址，可以用于前端ajax调用，后端用于做权限控制
     */
    @TableField("url")
    private String url;

    /**
     * 请求类型：GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
     */
    @TableField("method")
    private String method;

    /**
     * 子系统:0、common，1、platform，2、partner，3、hospital，4、patient	            用于限定维护菜单资源关系，公共资源允许所有菜单关联，其他资源只允许对应的菜单关联，如：平台菜单只允许关联到公共资源和平台资源
     */
    @TableField("subsystem")
    private Integer subsystem;

    /**
     * 分类:0、common，1、pc，2、app，3、wechat，4、miniapp
     */
    @TableField("category")
    private Integer category;

    /**
     * 启用状态:0 、停用，1、启用
     */
    @TableField("enabled")
    private Integer enabled;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 删除标志，是否有效:1 可用 0不可用
     */
    @TableField("valid")
    @TableLogic
    private Integer valid;

    /**
     * 创建人
     */
    @TableField("creator")
    private Long creator;

    /**
     * 创建人姓名
     */
    @TableField("creator_name")
    private String creatorName;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 更新人
     */
    @TableField("updater")
    private Long updater;

    /**
     * 更新人姓名
     */
    @TableField("updater_name")
    private String updaterName;

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 版本号
     */
    @TableField("version")
    @Version
    private Integer version;


    public static final String ID = "id";

    public static final String SERVICE_ID = "service_id";

    public static final String NAME = "name";

    public static final String URL = "url";

    public static final String METHOD = "method";

    public static final String SUBSYSTEM = "subsystem";

    public static final String CATEGORY = "category";

    public static final String ENABLED = "enabled";

    public static final String REMARK = "remark";

    public static final String VALID = "valid";

    public static final String CREATOR = "creator";

    public static final String CREATOR_NAME = "creator_name";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATER = "updater";

    public static final String UPDATER_NAME = "updater_name";

    public static final String UPDATE_TIME = "update_time";

    public static final String VERSION = "version";

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
